package vn.fpt.fsoft.entities;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;



/**
 * @author DinhTV Directorate mapping with directorate in database
 */
@Entity
@Table(name = "Directorate")
public class Directorate implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7753761930853496722L;
	private int directorateId;
	private Organisation organisation;
	
	private String directorateName;
	private String shortDescription;
	private Address address;
	private Contact contact;
	private Integer typeOfBusiness;
	private String fullDescription;
	private String phoneNumber;
	private String fax;
	private String email;
	private String webAddress;
	private String charityNumber;
	private String companyNumber;
	private Boolean status;

	private Set<Department> departments = new HashSet<Department>(0);

	public Directorate() {
	}

	public Directorate(int directorateId) {
		this.directorateId = directorateId;
	}

	

	@Id
	@GeneratedValue
	@Column(name = "DirectorateId", unique = true, nullable = false)
	public int getDirectorateId() {
		return this.directorateId;
	}

	public void setDirectorateId(int directorateId) {
		this.directorateId = directorateId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "OrgId",nullable=true)
	public Organisation getOrganisation() {
		return this.organisation;
	}

	public void setOrganisation(Organisation organisation) {
		this.organisation = organisation;
	}

	@Column(name = "DirectorateName", nullable = true)
	public String getDirectorateName() {
		return this.directorateName;
	}

	public void setDirectorateName(String directorateName) {
		this.directorateName = directorateName;
	}

	@Column(name = "ShortDescription", nullable = true)
	public String getShortDescription() {
		return this.shortDescription;
	}

	public void setShortDescription(String shortDescription) {
		this.shortDescription = shortDescription;
	}


	/**
	 * @return the address
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="AddressID",nullable=true)
	public Address getAddress() {
		return address;
	}

	/**
	 * @param address the address to set
	 */
	public void setAddress(Address address) {
		this.address = address;
	}

	/**
	 * @return the contact
	 */
	@ManyToOne(fetch= FetchType.LAZY)
	@JoinColumn(name="contactId")
	public Contact getContact() {
		return contact;
	}

	/**
	 * @param contact the contact to set
	 */
	public void setContact(Contact contact) {
		this.contact = contact;
	}

	@Column(name = "TypeOfBusiness", nullable = true)
	public Integer getTypeOfBusiness() {
		return this.typeOfBusiness;
	}

	public void setTypeOfBusiness(Integer typeOfBusiness) {
		this.typeOfBusiness = typeOfBusiness;
	}

	@Column(name = "FullDescription", nullable = true)
	public String getFullDescription() {
		return this.fullDescription;
	}

	public void setFullDescription(String fullDescription) {
		this.fullDescription = fullDescription;
	}

	@Column(name = "PhoneNumber", nullable = true)
	public String getPhoneNumber() {
		return this.phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	@Column(name = "Fax", nullable = true)
	public String getFax() {
		return this.fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	@Column(name = "Email", nullable = true)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "WebAddress", nullable = true)
	public String getWebAddress() {
		return this.webAddress;
	}

	public void setWebAddress(String webAddress) {
		this.webAddress = webAddress;
	}

	@Column(name = "CharityNumber", nullable = true)
	public String getCharityNumber() {
		return this.charityNumber;
	}

	public void setCharityNumber(String charityNumber) {
		this.charityNumber = charityNumber;
	}

	@Column(name = "CompanyNumber", nullable = true)
	public String getCompanyNumber() {
		return this.companyNumber;
	}

	public void setCompanyNumber(String companyNumber) {
		this.companyNumber = companyNumber;
	}

	@Column(name = "Status", nullable = true)
	public Boolean getStatus() {
		return this.status;
	}

	public void setStatus(Boolean status) {
		this.status = status;
	}


	@OneToMany(fetch=FetchType.LAZY,mappedBy="directorate")
	public Set<Department> getDepartments() {
		return this.departments;
	}

	public void setDepartments(Set<Department> departments) {
		this.departments = departments;
	}

}
